<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Reads mouse event</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ncurses-getmaxyx.html">ncurses_getmaxyx</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-getyx.html">ncurses_getyx</a></div>
 <div class="up"><a href="ref.ncurses.html">Ncurses 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ncurses-getmouse" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ncurses_getmouse</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5 &lt; 5.3.0, PECL ncurses &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">ncurses_getmouse</span> &mdash; <span class="dc-title">Reads mouse event</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ncurses-getmouse-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>ncurses_getmouse</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$mevent</code></span>
   )</div>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>
  <p class="para">
   <span class="function"><strong>ncurses_getmouse()</strong></span> reads mouse event out of
   queue. 
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ncurses-getmouse-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">mevent</code></em></dt>

     <dd>

      <p class="para">
       Event options will be delivered in this parameter which has to be an
       array, passed by reference (see example below).
      </p>
      <p class="para">
       On success an associative array with following keys will be delivered:
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          &quot;id&quot; : Id to distinguish multiple devices
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          &quot;x&quot; : screen relative x-position in character cells
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          &quot;y&quot; : screen relative y-position in character cells
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          &quot;z&quot; : currently not supported
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          &quot;mmask&quot; : Mouse action
         </p>
        </li>
       </ul>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ncurses-getmouse-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>FALSE</code></strong> if a mouse event is actually visible in the given window,
   otherwise returns <strong><code>TRUE</code></strong>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.ncurses-getmouse-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-603">
    <p><strong>Example #1 <span class="function"><strong>ncurses_getmouse()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">switch&nbsp;(</span><span style="color: #0000BB">ncurses_getch</span><span style="color: #007700">()){<br />&nbsp;&nbsp;case&nbsp;</span><span style="color: #0000BB">NCURSES_KEY_MOUSE</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">ncurses_getmouse</span><span style="color: #007700">(</span><span style="color: #0000BB">$mevent</span><span style="color: #007700">)){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$mevent</span><span style="color: #007700">[</span><span style="color: #DD0000">"mmask"</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">NCURSES_MOUSE_BUTTON1_PRESSED</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$mouse_x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$mevent</span><span style="color: #007700">[</span><span style="color: #DD0000">"x"</span><span style="color: #007700">];&nbsp;</span><span style="color: #FF8000">//&nbsp;Save&nbsp;mouse&nbsp;position<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$mouse_y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$mevent</span><span style="color: #007700">[</span><span style="color: #DD0000">"y"</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;break;<br /><br />&nbsp;&nbsp;default:<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;....&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.ncurses-getmouse-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ncurses-ungetmouse.html" class="function" rel="rdfs-seeAlso">ncurses_ungetmouse()</a> - Pushes mouse event to queue</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ncurses-getmaxyx.html">ncurses_getmaxyx</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-getyx.html">ncurses_getyx</a></div>
 <div class="up"><a href="ref.ncurses.html">Ncurses 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
